package com.sky.merchant.controller;

import com.sky.common.annotation.Anonymous;
import com.sky.common.core.domain.AjaxResult;
import com.sky.merchant.domain.ResShop;
import com.sky.merchant.service.IResShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Anonymous
@RestController
@RequestMapping("/resShop")
@Api(value = "ResShopController", tags = {"店铺管理接口"})
public class ResShopController {

    @Autowired
    private IResShopService resShopService;

    /**
     * 获取所有店铺列表
     *
     * @return 封装了店铺列表的AjaxResult对象
     */
    @GetMapping("/list")
    @ApiOperation(value = "获取所有店铺列表", notes = "返回所有店铺的列表信息")
    public AjaxResult list() {
        List<ResShop> resShopList = resShopService.selectResShopList();
        return AjaxResult.success(resShopList);
    }

    /**
     * 根据ID获取店铺信息
     *
     * @param id 店铺ID
     * @return 封装了店铺信息或错误消息的AjaxResult对象
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID获取店铺信息", notes = "根据店铺ID返回对应的店铺信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        ResShop resShop = resShopService.selectResShopById(id);
        return resShop != null ? AjaxResult.success(resShop) : AjaxResult.error("店铺未找到");
    }

    /**
     * 创建店铺
     *
     * @param resShop 店铺信息
     * @return 封装了操作结果或错误消息的AjaxResult对象
     */


    /**
     * 更新店铺信息
     *
     * @param resShop 店铺信息
     * @return 封装了操作结果或错误消息的AjaxResult对象
     */


    /**
     * 删除店铺
     *
     * @param id 店铺ID
     * @return 封装了操作结果或错误消息的AjaxResult对象
     */

}